﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mb
{
    class Program
    {
        static Corpus cp;
        static void testtest(string subPath)
        {
            try
            {
                cp = new Corpus(subPath);
                cp.TrainCorpus();
                cp.GetSentimentTypeStatistics(subPath);
             /*   while (true)
                {
                    try
                    {
                        string select = Console.ReadLine();
                        int item = int.Parse(select);
                        if (item == 0)  // exit this corpus
                        {
                            break;
                        }
                        if (item == 1) // get sentence from console
                        {
                            Console.WriteLine("Please input the content:");
                            string sentence = Console.ReadLine();
                            SentimentType st = cp.GetSentimentTypeFromConsole(sentence);
                            Console.WriteLine(st);
                            continue;
                        }
                        if (item == 2) // get sentence from file
                        {
                            Console.WriteLine("Please input the file name, include the full path:");
                            string filename = Console.ReadLine();
                            SentimentType st = cp.GetSentimentTypeFromFile(filename);
                            Console.WriteLine(st);
                            continue;
                        }
                        ConsoleColor old = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Invalid Input. Please input 0, 1 or 2");
                        Console.ForegroundColor = old;
                    }
                    catch (Exception ex)
                    {
                        ConsoleColor old = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex.Message);
                        Console.ForegroundColor = old;
                    }
                }*/
                GC.Collect();
            }
            catch (Exception ex)
            {
                ConsoleColor old = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
                Console.ForegroundColor = old;
            }
        }
        static void Main(string[] args)
        {
      //      testtest(@"mb\corpus\qingming");
            
            Console.WriteLine("Corpus: hospital");
            testtest(@"mb\corpus\yiyuan");
     
            //       testtest(@"mb\corpus\NB_del_4000");
            
            Console.WriteLine("Corpus: book");
            testtest(@"mb\corpus\Book_del_4000");
            
            Console.WriteLine("Corpus: hotel");
            testtest(@"mb\corpus\htl_del_4000");

            Console.ReadLine();
        }
    }
}
